#!/usr/bin/env python3
# -*- coding: utf-8-

import logging

import pygame
from pygame import display
from pygame import event

RESOLUTION = (300,300)
FRAMERATE = 30

class Brick(BaseEntity):
    def __init__(self, position, size, surface):
        pass

    def draw(self):
        pygame.draw.rect(self.surface, self.color, pygame.Rect(self.position, self.size), 1)

class Arkanoid:
    def __init__(self):
        self.resolution = (300,300)

        self.setup()

        self.loop()

        self.quit()

    def loop(self):
        while self.event_loop():

            self.render()
            
            display.flip()

    def render(self):
        self.paddle.draw()

    def event_loop(self):
        for e in event.get():
            if e.type == pygame.KEYDOWN:
                if e.key == pygame.K_ESCAPE:
                    logging.info('escape')
                    return False

                if e.key == pygame.K_LEFT:
                    self.paddle.velocity -= 1

                if e.key == pygame.K_RIGHT:
                    self.paddle.velocity += 1

                if e.key == pygame.K_UP:
                    self.paddle.velocity -= 1

                if e.key == pygame.K_DOWN:
                    self.paddle.velocity -= 1

        return True

    def setup(self):
        pygame.init()                                                                    
        self.screen = display.set_mode(self.resolution)

        self.paddle = Brick((150,200),(20,20),self.screen)

    def quit(self):
        pygame.quit()

if __name__ == "__main__":
    pygame.init()
    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
    Arkanoid()
